package corewarsxxi.logic;

import java.io.Serializable;

/**
 *
 * @author ei10139
 */
public class AMImmediate extends AddressingMode implements Serializable
{
    /** Simplefied Singleton that provides access to the public final static <code>AMImmediate</code> instance.*/
    public static final AMImmediate self = new AMImmediate();

    /**
     * Protected constructor of AMImmediate.
     */
    protected AMImmediate() {}

    /**
     * Calculates the value according to the current state of the memory array.
     * @param value     the value.
     * @param aField    look into either A-Field of B-Field.
     * @return          the value from Cores memory.
     */
    public int getValue(int value, boolean aField)
    {
        return value;
    }

    /**
     * Overrides the default Object.toString() function.
     * @return Always returns "<code>##</code>".
     */
    @Override
    public String toString()
    {
        return "##";
    }

    /**
     * Makes use of the Singleton pattern and returns the public static object.
     * @return it<i>self</i>.
     */
    @Override
    public AddressingMode getSelf() {
        return this.self;
    }
}
